{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 190,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "第185次输光所有钱\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZMAAAD8CAYAAACyyUlaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAHQBJREFUeJzt3X+cVfWd3/HXW0bARBGU0RgggWxms6tut8GpIU2T7oYNIEmDbWMXN4/CI0sfPJI1TbLpdsXax5JN4mPNpl1bWuM+3EjFXdcfdZNKuxjCmmTTPOqvwaiAaJhgIiMIoyASFWGGT/+439Ezw7l3mDlz7p259/18PO5jzv2c7znf75wZ5s33nHPvVURgZmZWxGmNHoCZmU18DhMzMyvMYWJmZoU5TMzMrDCHiZmZFeYwMTOzwhwmZmZWmMPEzMwKc5iYmVlhbY0eQL3MnDkz5s6d2+hhmJlNKFu3bn0hItqHa9cyYTJ37ly6uroaPQwzswlF0s9PpZ1Pc5mZWWHDhomk9ZIOSNqes+4PJIWkmem5JK2T1C3pCUnzM21XStqVHisz9UskbUvbrJOkVD9H0pbUfoukGcP1YWZmjXEqM5NbgSVDi5LmAB8Bns2ULwM60mM1cFNqew6wFngfcCmwdiAcUpvVme0G+loD3B8RHcD96XnVPszMrHGGDZOI+CFwMGfVDcAfAtn3sF8G3BYVDwLTJV0ALAa2RMTBiDgEbAGWpHXTIuKBqLwX/m3A5Zl9bUjLG4bU8/owM7MGGdU1E0kfB56LiMeHrJoF7Mk870m1WvWenDrA+RGxDyB9PW+YPvLGuVpSl6Su3t7eU/zuzMxspEYcJpLeAlwL/FHe6pxajKJecwinuk1E3BwRnRHR2d4+7J1tZmY2SqOZmfwSMA94XNLPgNnAo5LeRmWWMCfTdjawd5j67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vvbwMN/B1zmNT2CNAhaV763+5yYGO9Ok/nZG8BdkbEn2Xq2esN/xwYuNNkI7Bc0hRJ84AOKhf+xnpcb5V01sAylQu421P/A3eDrATuzYxrRbqjZAFweGAqXpJB/2Ns9PHKGOnx2QwskjQjneJZlGpjStIS4Grg4xHxaqbeLmlSWn4XleOzO43tiKQF6Xd0ReZ7GctxjfTnVs9/r78FPBURb5y+qufxqva3gUb+jhW5o6AVHlTugvgJlf9lXFvnvv8JlSnnE8Bj6bEU+EtgW6pvBC7IbHNtGuvTFLxjpMa43kXlTpnHgR0DxwU4F7gf2JW+npPqAm5M49oGdJZ4zN4CvAicnanV/XhRCbN9wHEq//tbNZrjQ+UaRnd6fKqkcXVTOW8+8Dv256ntv0w/38eBR4F/ltlPJ5U/7j8F/jvpBdBjPK4R/9zG+t9r3rhS/Vbg00Pa1vN4Vfvb0LDfMb8C3szMCvNpLjMzK8xhYmZmhTlMzMysMIeJmZkV5jAxM7PCHCZmZlaYw8TMzApzmJiZWWH/H9knXwXwStgWAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "赔率：1.5  每次下注比率: 0.5\n",
      "最大值：1372258.0 最小值：0.0 平均值：7945.0\n",
      "最后总资金：0.0\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "n=2000\n",
    "f=0.5\n",
    "odds=1.5\n",
    "capital=200    #本金\n",
    "random_state=np.random.randint(0,2,n)#生成硬币正反的随机序列\n",
    "random_state[random_state==0]=-1  #将序列中0变成负1，以便求出\n",
    "Amount=np.zeros(n)\n",
    "for i in range(n):\n",
    "    if i==0:\n",
    "        if random_state[i]>0:\n",
    "            Amount[i]=capital+odds*f*capital*random_state[i]\n",
    "        else:\n",
    "            Amount[i]=capital+f*capital*random_state[i]\n",
    "    else:\n",
    "        if random_state[i]>0:\n",
    "            Amount[i]=Amount[i-1]+odds*f*Amount[i-1]*random_state[i] #如果赢总资产是上一轮资产+赔率*下注金\n",
    "        else:\n",
    "            Amount[i]=Amount[i-1]+f*Amount[i-1]*random_state[i]      #如果输了，输下注金\n",
    "        if Amount[i]<=0.01:\n",
    "            print(\"第\"+str(i)+\"次输光所有钱\")\n",
    "            break\n",
    "plt.plot(Amount,'-')\n",
    "plt.show()\n",
    "print(\"赔率：\"+str(odds)+\"  每次下注比率: \"+str(f))\n",
    "print(\"最大值：\"+str(round(np.max(Amount),0)),\"最小值：\"+str(round(np.min(Amount))),\"平均值：\"+str(round(np.average(Amount))))\n",
    "print(\"最后总资金：\"+str(round(Amount[n-1],0)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 198,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAD8CAYAAAB+UHOxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3Xl4VNX5wPHvyQ5JCNnYl7Ar+1ZEcUGQTahYd21dsdSKVavVQqlVa1vx11q0tYpacVe01roBKiiCKPsOKoR9X7JvJJNkzu+PuTNzZ0tmwizJ5P08T57cOXPmzskkue+9557zHqW1RgghRPMTE+kGCCGEiAwJAEII0UxJABBCiGZKAoAQQjRTEgCEEKKZkgAghBDNlAQAIYRopiQACCFEMyUBQAghmqm4SDegLllZWTonJyfSzRBCiCZlw4YNeVrr7PrqNeoAkJOTw/r16yPdDCGEaFKUUgf8qSddQEII0UxJABBCiGZKAoAQQjRTEgCEEKKZkgAghBDNlAQAIYRopiQACCFEMyUBQAghGpGqmlreXXcIqzX0y/U26olgQgjR3Dy7bA9Pf5FLy8RYpgzsENL3kisAI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wu0rVQpNdL4G73J9LMEs12B/t7C+f96CfCD1trRtRPOz8vXsYFI/o2dyV3txvqF7e75LmzRfHaY3/t8bJdjW4HNxtelwOvANqP8I6C96TWzjbbu5AxHGtTRru7YRlhsAXbYPxcgE/gCyDW+ZxjlCviX0a5twPAQfmYtgXwgzVQW9s8LWwA6BlRjO8ua1pDPB1uf/G7j69YQtWs3tn5g+9/YPKPulcbvdwuwEfixaT/DsR2Q9wDPYEwEDXK7Av69Bfv/1Vu7jPJXgDvc6obz8/J1bIjY35jMBBZCiGYqGruAhBBC+EECgBBCNFMSAIQQopmSACCEEM2UBAAhhGimJAAIIUQzJQFACCGaKQkAQgjRTP0/bItkjli9Cw4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "恒定下注金额\n",
      "赔率：1.1  每次下注资金: 40.0\n",
      "最大值：4656.0 最小值：64.0 平均值：2025.0\n",
      "最后总资金：4536.0\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "n=2000\n",
    "f=0.2\n",
    "odds=1.1\n",
    "capital=200    #本金\n",
    "random_state=np.random.randint(0,2,n)#生成硬币正反的随机序列\n",
    "random_state[random_state==0]=-1  #将序列中0变成负1，以便求出\n",
    "Amount=np.zeros(n)\n",
    "for i in range(n):\n",
    "    if i==0:\n",
    "        if random_state[i]>0:\n",
    "            Amount[i]=capital+odds*f*capital*random_state[i]\n",
    "        else:\n",
    "            Amount[i]=capital+f*capital*random_state[i]\n",
    "    else:\n",
    "        if random_state[i]>0:\n",
    "            Amount[i]=Amount[i-1]+odds*f*capital*random_state[i] #如果赢总资产是上一轮资产+赔率*下注金\n",
    "        else:\n",
    "            Amount[i]=Amount[i-1]+f*capital*random_state[i]      #如果输了输下注金\n",
    "        if Amount[i]<=0:\n",
    "            print(\"第\"+str(i)+\"次输光所有钱\")\n",
    "            break\n",
    "plt.plot(Amount,'-')\n",
    "plt.show()\n",
    "print(\"恒定下注金额\")\n",
    "print(\"赔率：\"+str(odds)+\"  每次下注资金: \"+str(f*capital))\n",
    "print(\"最大值：\"+str(round(np.max(Amount),0)),\"最小值：\"+str(round(np.min(Amount))),\"平均值：\"+str(round(np.average(Amount))))\n",
    "print(\"最后总资金：\"+str(round(Amount[n-1],0)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
